package cn.detu.baking.controller;

import cn.detu.baking.mapper.BannerMapper;
import cn.detu.baking.response.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Date:2024/3/26
 * Author：
 * Description:
 */
@RestController
@RequestMapping("/v1/banners/")
public class BannerController {
    @Autowired
    BannerMapper mapper;

    @RequestMapping("")
    public ResultVO select(){
        return ResultVO.ok(mapper.select());
    }

    @RequestMapping("admin")
    public ResultVO admin(){
        return ResultVO.ok(mapper.selectForAdmin());
    }

    @RequestMapping("/{id}/delete")
    public ResultVO delete(@PathVariable Long id){
        mapper.deleteById(id);
        return ResultVO.ok();

    }

}
